package com.suray.wcs.res.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

public enum RgvType implements IEnum<Integer> {
    FOUR_GENERATIONS(1, "4代车"),

    FIVE_POINT_FOUR_TL(2, "5.4TL-机械车"),

    RGV_SIX_POINT_ZERO(3, "两栖车"),

    RGV_ROLLER(4, "滚筒车"),

    RGV_SON_MOTHER(5, "子母车"),

    RGV_FORK(6, "叉车"),

    RGV_SEER_COMM(50, "仙工通讯方式"),

    FIVE_POINT_FOUR_TS(22, "5.4TS-液压车"),
    ;


    @EnumValue
    private final Integer state;
    @JsonValue
    private final String desc;

    RgvType(int state, String desc) {
        this.state = state;
        this.desc = desc;
    }

    public static RgvType parseDes(String desc) {
        RgvType[] codeLevels = RgvType.values();
        for (RgvType codeLevel : codeLevels) {
            if (codeLevel.desc.equals(desc)) {
                return codeLevel;
            }
        }
        throw new IllegalArgumentException("小车类型描述错误：" + desc);
    }
    public static RgvType parseState(int state) {
        RgvType[] codeLevels = RgvType.values();
        for (RgvType codeLevel : codeLevels) {
            if (codeLevel.state.equals(state)) {
                return codeLevel;
            }
        }
        throw new IllegalArgumentException("小车类型描述错误：" + state);
    }
    @Override
    public String toString() {
        return desc;
    }

    @Override
    public Integer getValue() {
        return state;
    }

    /**
     * @param state
     * @return CodeType
     */
    public static RgvType parseCodeLevel(int state) {
        RgvType[] codeLevels = RgvType.values();
        for (RgvType codeLevel : codeLevels) {
            if (codeLevel.state == state) {
                return codeLevel;
            }
        }
        throw new IllegalArgumentException("小车类型参数异常:" + state);
    }
}
